<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title></title>
  <link rel="stylesheet" href="/stylesheets/work.css">
</head>

<body>
  <div class="container">
    <div class="msg_content">
      <h1>留言板</h1>
      <%if(user){ %>
        <nav>
          <%=user.loginname %> 已登录
            <a href="/work/logout">退出</a>
        </nav>

        <div class="msg_send">
          <form action="/work/message" method="post">
            <!-- <input type="text" name="message" value=""> -->
            <textarea name="message" rows="8" cols="80" wrap="virtual"></textarea>
            <button class="" type="submit">发表</button>
          </form>
        </div>

      <% } else{ %>

          <h4>登录后才能发言</h4>

          <div class="msg_head">
            <form action="/work/to_login" method="get">
              <button class="to_button" type="submit">登陆</button>
            </form>
            <form action="/work/to_reg" method="get">
              <button class="to_button" type="submit">注册</button>
            </form>
          </div>

        <% } %>
    </div>

    <% if(!list.length == 0){ %>
    <div class="msg_body">
      <%list.forEach(function(item){ %>
        <nav class="msg_01">
          <%=item.name %>
        </nav>
        <nav class="msg_02">
          <%=item.message%>
        </nav>
      <%})%>
    </div>
    <% } %>
  </div>
</body>

</html>
